// import com.alibaba.druid.sql.ast.SQLStatement;
// import com.alibaba.druid.sql.ast.statement.SQLColumnDefinition;
// import com.alibaba.druid.sql.ast.statement.SQLCreateTableStatement;
// import com.alibaba.druid.sql.ast.statement.SQLTableElement;
// import com.alibaba.druid.sql.ast.statement.SQLUniqueConstraint;
// import com.alibaba.druid.util.FnvHash;

#pragma once
#include "../../utils/common_ptr.h"
#include "../ast/SQLObject.h"

enum SchemaObject_Type
{
  Sequence,
  Table,
  View,
  Index,
  Function
};

class SchemaObject :public SQLObject
{
public:
  Schema_ptr schema;
  string_ptr name;
  long hashCode64;

  SchemaObjectType_ptr type;
  SQLStatement_ptr statement;
  long rowCount;

  SchemaObject(Schema_ptr schema, string_ptr name, SchemaObjectType_ptr type);

  SchemaObject(Schema_ptr schema, string_ptr name, SchemaObjectType_ptr type, SQLStatement_ptr statement);

  SQLObject_ptr clone();

  long nameHashCode64();

  SQLStatement_ptr getStatement();

  SQLColumnDefinition_ptr findColumn(string_ptr columName);

  SQLColumnDefinition_ptr findColumn(long columNameHash);

  BOOL_ptr matchIndex(string_ptr columnName);

  BOOL_ptr matchKey(string_ptr columnName);

  string_ptr getName();

  SchemaObjectType_ptr getType();

  long getRowCount();

  Schema_ptr getSchema();
};
